


//1.基本结构语法

let singers = ['周杰伦','陈奕迅','许嵩','张震岳']

let [f1] = singers

console.log(f1); //周杰伦

//2.解构指定元素

let [,f2] = singers

console.log(f2);


//3.解构多维数组

let singers2 = ['周杰伦','陈奕迅',['汪苏泷','李荣浩','邓紫棋'],'许嵩','张震岳']

let [,,[,,f3]] = singers2

console.log(f3); //邓紫棋

//4.剩余元素

let [f4,f5,...f6] = singers2

console.log(f4,f5,f6);

//剩余元素编写的时候要注意 剩余元素必须放在最后

// let [f7,...f8,f9] = singers2 ❌错误写法


//5.对象和数组的混合解构

let node = {
    personalInfo: {
        basicInfo: {
            name: {
                firstName: 'mike',
                lastName: 'deep'
            },
        }
    },
    levelRange: [1, 3]
};

let  {personalInfo :{ basicInfo: { name: {lastName} } }, levelRange:[,b] } = node

console.log(lastName); // deep

console.log(b); // 3